package ru.voronoy.thefifteen.entity;

import java.awt.Color;
import java.awt.Point;

import javax.swing.JPanel;
import javax.swing.border.LineBorder;

import ru.voronoy.thefifteen.config.BoneConf;

/**
 * Класс "костяшки"
 * 
 * @author d.voronoy
 * 
 */

public class Bone extends JPanel implements IBone {
	public Bone(Point point) {
		this.setSize(BoneConf.getInstance().SPACE, BoneConf.getInstance().SPACE);
		this.setLocation(point);
		this.setBorder(new LineBorder(BoneConf.getInstance().BorderColor,
				BoneConf.getInstance().BorderThikness,
				BoneConf.getInstance().RoundCorners));
		this.setBackground(Color.WHITE);
	}

	public void MoveRight() {
		this.setLocation(this.getX() + BoneConf.getInstance().SPACE,
				this.getY());
	}

	public void MoveLeft() {
		this.setLocation(this.getX() - BoneConf.getInstance().SPACE,
				this.getY());

	}

	public void MoveUp() {
		this.setLocation(this.getX(), this.getY()
				- BoneConf.getInstance().SPACE);
	}

	public void MoveDown() {
		this.setLocation(this.getX(), this.getY()
				+ BoneConf.getInstance().SPACE);
	}

}
